import type { MaFormItem } from "@mineadmin/form";
import hasAuth from "@/utils/permission/hasAuth.ts";
import MaUploadFile from "@/components/ma-upload-file/index.vue";
import { concat } from "lodash-es";
import { AUDIO_TYPE_OPTIONS } from "./common";

export default function getFormItems(
  formType: "add" | "edit" = "add",
  t: any,
  model: any
): MaFormItem[] {
  return concat([
    // 音频类型选择
    {
      label: "音频类型",
      prop: "type",
      render: "select",
      renderProps: {
        placeholder: t("form.pleaseSelect", { msg: "音频类型" }),
        options: AUDIO_TYPE_OPTIONS
      },
      itemProps: { rules: [{ required: true, message: "请选择音频类型" }] },
    },
    // 文件内容
    {
      label: "文件内容",
      prop: "text",
      render: "input",
      renderProps: {
        type: "textarea",
        placeholder: t("form.pleaseInput", { msg: "文件内容" }),
        rows: 4,
        maxlength: 1000,
        showWordLimit: true,
      },
      itemProps: { rules: [{ required: true, message: "请输入文件内容" }] },
    },
  ]);
}
